package DataBase;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class CheckBalancePresentCard {
	
	private int numCard;
	private Float balance;
	
	public CheckBalancePresentCard(int numCard)
	{
		this.numCard=numCard;
	}
	
	public Float getBalance()
	{
		
		SQLConnection sc=new SQLConnection();
		PreparedStatement ps;
		try {
			ps = sc.getConnection().prepareStatement("Select balance from client_club where numCard=?;");
			ps.setInt(1,numCard);
			ResultSet rs=ps.executeQuery();	
			 while(rs.next())
		        {   
				 balance=rs.getFloat(1);
		        }
		    } 
		
		
		 catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	
	return balance;
}
	}


